package io.raytracing;

import java.io.FileNotFoundException;

import graphics.rasterizing.model.Triangle;
import graphics.raytracing.Model;
import graphics.raytracing.SimpleTriangleMesh;

public class SimpleReader implements ModelReader{
	io.rasterizing.SimpleReader reader;
	public SimpleReader(String file) throws FileNotFoundException
	{
		this.reader=new io.rasterizing.SimpleReader(file);
	}
	@Override
	public Model read() {
		graphics.rasterizing.model.Model m = reader.read();
		SimpleTriangleMesh mesh = new SimpleTriangleMesh();
		for(Triangle t:m.getTriangles())
			{
				mesh.add(new graphics.raytracing.Triangle(t.tri));
			}
		return mesh;
	}
	
}
